package com.atguigu.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class UserServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //1,从request中获取参数

        String username = req.getParameter("username");

        //2,调用业务层方法
        String info= "YES";
        if ("atguigu".equals(username)){

            info = "NO";
        }

        //3,返回结果

        //4,设置content-type
//        resp.setContentType("text/html;charset=utf-8");
        PrintWriter writer = resp.getWriter();
        writer.write(info);


//        super.service(req, resp);
    }
}
